import Mock from 'mockjs'
const {
  rechargeList
} = Mock.mock({
  'rechargeList|35': [{
    'id|+1': 1,
    'title|1': ['在线充值', '醉仙楼小龙虾', '外婆卤肉饭', '有家烧烤'], 
  }]
});

Mock.mock(/\/api\/recharge\/list/, 'post', (data) => {
  var body = JSON.parse(data.body)
  var [page, size, total] = [body.page, body.size, rechargeList.length]
  var len = total / size  //可以加载几次
  var totalPages = len - parseInt(len) > 0 ? parseInt(len) + 1 : len;
  var limit = page == 1 ? 10 : page * size;//10,20,30,40
  var list = rechargeList.slice((page - 1) * size, limit);
  return {
    rechargeList,
    size,
    total,
    totalPages,
    list
  }
})